/*
 * @Author: Aaron Huang
 * @Date: 2022-10-19 14:26:47
 * @LastEditors: Even Liu
 * @LastEditTime: 2022-11-10 18:08:10
 * @Description: file content
 * @FilePath: \ias_ui\src\api\coi\CBEC\newProducts.js
 * @Company: 沃尔玛
 */

import request from '@/utils/request'
import { exportFile } from '@/api/exportFile'

const prefix1 = process.env.VUE_APP_BASE_API9 // sku

const url = {
  newList_CBEC_API: `${prefix1}/oneButton/skuInfo/queryOneButtonOnlineBuiltSkuPage`,
  newListExportFile_CBEC_API: `${prefix1}/oneButton/skuInfo/exportOneButtonOnlineBuiltSku`,
  newBuilding_CBEC_API: `${prefix1}/online/design/saveGoodsTypeAndChannelCode`,
  rePush_CBEC_API: `${prefix1}/skuInfo/sku-drop/repushFailedSku`,
  getInfo_CBEC: `${prefix1}/skuInfo/findBuyerBuildSkuPage`, // 获取CBEC一键代发sku
  saveCBEC: `${prefix1}/online/design/saveCbecOneButton`, // 保存CBEC sku建品信息
  saveAsChannel_CBEC: `${prefix1}/online/design/saveCbecOneButton`, // 发布CBEC sku建品信息
  rePullProductsInfo: `${prefix1}/skuInfo/sku-drop/pull`, // 拉取商品信息
  getHsCodeDetail: `${prefix1}/skuInfo/sku-drop/getHsCodeDetail`, // 根据商品编号查询价格信息
  getItemTaxPrice: `${prefix1}/skuInfo/sku-drop/getItemTaxPrice`, // 计算税率
  findCbecSkuBuildInfoBySkuId: `${prefix1}/online/design/findCbecSkuBuildInfoBySkuId`, // 查询
  saveAndPushSku: `${prefix1}/skuInfo/sku-drop/saveAndPushSku` // 推送CBEC
}

export const newList_CBEC_API = (data) => {
  return request({
    method: 'post',
    url: url.newList_CBEC_API,
    data
  })
}

export const newListExportFile_CBEC_API = (data, name) => {
  return exportFile(url.newListExportFile_CBEC_API, data, name)
}

export const newBuilding_CBEC_API = (data) => {
  return request({
    method: 'post',
    url: url.newBuilding_CBEC_API,
    data
  })
}

export const rePush_CBEC_API = (data) => {
  return request({
    method: 'post',
    url: url.rePush_CBEC_API,
    data
  })
}
// 获取CBEC一键代发sku
export const getInfo_CBEC = (data) => {
  return request({
    method: 'post',
    url: url.getInfo_CBEC,
    data
  })
}
// 保存CBEC sku建品信息
export const saveCBEC = (data) => {
  return request({
    method: 'post',
    url: url.saveCBEC,
    data
  })
}
// 发布CBEC sku建品信息
export const saveAsChannel_CBEC = (data) => {
  return request({
    method: 'post',
    url: url.saveAsChannel_CBEC,
    data
  })
}
// 拉取商品信息
export const rePullProductsInfo = (data) => {
  return request({
    method: 'post',
    url: url.rePullProductsInfo,
    data
  })
}
// 拉取商品信息
export const getHsCodeDetail = (data) => {
  return request({
    method: 'post',
    url: url.getHsCodeDetail,
    data
  })
}
// 拉取商品信息
export const getItemTaxPrice = (data) => {
  return request({
    method: 'post',
    url: url.getItemTaxPrice,
    data
  })
}
// 查询
export const findCbecSkuBuildInfoBySkuId = (params) => {
  return request({
    method: 'get',
    url: url.findCbecSkuBuildInfoBySkuId + '/' + params
  })
}

export const saveAndPushSku = (data) => {
  return request({
    method: 'post',
    url: url.saveAndPushSku,
    data
  })
}
